package com.example.consumer.controller;

import com.example.consumer.config.FeignClientConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController()
public class ConsumerController {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private FeignClientConfig feignClientConfig;

    @GetMapping("/restTemplateConsumerTest")
    public String restTemplateConsumerTest() {
        return restTemplate.getForObject("http://spring-cloud-alibaba-provider/ProviderTest", String.class);
    }

    @GetMapping("/feignClientConsumerTest")
    public String feignClientConsumerTest() {
        return feignClientConfig.ProviderTest();
    }

}
